import java.util.Scanner;

/**
 * @Author YuanYuan
 * @Date 2022/9/13
 * @Time 19:05
 */
public class TestDemo1 {
    public static class Counter {
        volatile public int count = 0;
    }

    public static void main(String[] args) {
        Counter counter = new Counter();

        Thread thread = new Thread(()-> {
            while (0 == counter.count) {
                ;
            }
            System.out.println("线程结束");
        });

        thread.start();

        Thread thread1 = new Thread(()-> {
            System.out.println("修改count");
            Scanner scanner = new Scanner(System.in);
            counter.count = scanner.nextInt();
        });

        thread1.start();

    }
}
